﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Configuration;
using Olympic_email_to_future.IDAL;
using Olympic_email_to_future.Module;

namespace Olympic_email_to_future.DALFactory
{
    public class DataAccess
    {
        private static readonly string path = ConfigurationManager.AppSettings["DAL"];

        private DataAccess() { }

        public static IDAL.IMailInfo CreateEmailDAL()
        {
            string className = path + ".MailDAL";
            return (IDAL.IMailInfo)Assembly.Load(path).CreateInstance(className);
        }
        public static IAttachmentInfo CreateAttachmentDAL()
        {
            string className = path + ".AttachmentDAL";
            return (IAttachmentInfo)Assembly.Load(path).CreateInstance(className);
        }
        public static IDAL.IUserInfo CreateUserDAL()
        {
            string className = path + ".UserDAL";
            return (IDAL.IUserInfo)Assembly.Load(path).CreateInstance(className);
        }
        public static IDAL.IFeedbackInfo CreateFeedbackInfo()
        {
            string className = path + ".FeedbackDAL";
            return (IDAL.IFeedbackInfo)Assembly.Load(path).CreateInstance(className);
        }
    }
}
